﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Marmat.Foundation
{
    public class SelectionRecordColumnCollection : List<SelectionRecordColumn>
    {

        /// <summary>
        /// 添加列
        /// </summary>
        /// <param name="columnName">需要添加的列名</param>
        /// <returns></returns>
        public SelectionRecordColumn Add(string columnName)
        {
            SelectionRecordColumn column = new SelectionRecordColumn(columnName);
            this.Add(column);
            return column;
        }

        /// <summary>
        /// 添加列
        /// </summary>
        /// <param name="columnName">需要添加的列名</param>
        /// <param name="caption">列的标题</param>
        /// <returns></returns>
        public SelectionRecordColumn Add(string columnName, string caption)
        {
            SelectionRecordColumn column = new SelectionRecordColumn(columnName, caption);
            this.Add(column);
            return column;
        }
        /// <summary>
        /// 添加列
        /// </summary>
        /// <param name="columnName">需要添加的列名</param>
        /// <param name="caption">列的标题</param>
        /// <param name="width">列的宽度</param>
        /// <returns></returns>
        public SelectionRecordColumn Add(string columnName, string caption, int width)
        {
            SelectionRecordColumn column = new SelectionRecordColumn(columnName, caption, width);
            this.Add(column);
            return column;
        }

        /// <summary>
        /// 通过列名批量添加列
        /// </summary>
        /// <param name="collection">等待添加的列的集合</param>
        public void AddRange(params string[] collection)
        {
            foreach (var columnName in collection)
            {
                this.Add(columnName);
            }
        }
    }
}
